﻿@model GN.Pay.Core.Values.PayNotifyData
@{
    Layout = null;
}
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <link href="~/Content/payreturn/css/core.css" rel="stylesheet" />
    <link href="~/Content/payreturn/css/index.css" rel="stylesheet" />
    <script src="~/Scripts/jquery-2.1.4.min.js"></script>
    <script src="~/Scripts/jquery.signalR-2.2.1.js"></script>
    <title>支付提示</title>
</head>
<body class="success">
    <div class="success-top">
        <div class="content-top clearfix">
            <a class="left" href="javascript:;"><img src="~/Content/payreturn/images/logo.png" /></a>
            <ul class="right success-step mt10 clearfix">
                <li><i class="step-1">1</i>填写订单<img src="~/Content/payreturn/images/right.png" alt="" /></li>
                <li><i class="step-1">2</i>提交订单<img src="~/Content/payreturn/images/right.png" alt="" /></li>
                <li><i class="step-1">3</i>支付成功</li>
            </ul>
        </div>
    </div>
    <div class="content clearfix">
        <div class="ticket-success">
            <img src="~/Content/payreturn/css/img/bg.png" />
            <div class="success-text">
                <p class="c-green f24px">恭喜您，<span>订单号 @Model.OrderNo</span>支付成功</p>
                <p class="c-900 f16px"><s:property value="" /><span class="ce50" id="num">8秒后&nbsp;&nbsp;&nbsp;</span>即将跳转至个人订单页面</p>
            </div>
        </div>
    </div>
    <script type="text/javascript">
        /*  倒计时及跳转
              count：倒计时（秒）
              tradeNo：交易号
        */        
        $(function () {
            var count = 8;//默认8秒跳转
            var tradeNo = '@Model.TradeNo';
            var interval = null;
            var jump = function () {
                interval = setInterval(function () {
                    if (count > 0) {
                        count--;
                        $('#num').attr('innerHTML', count);
                        $("#num").html(count + "秒后&nbsp;&nbsp;&nbsp");
                    } else {
                        clearInterval(interval);
                        location.href = "/Cashie/PayRedirectResult?tradeNo=" + tradeNo;
                    }
                }, 1000);
            };
            jump();
            var connection = $.hubConnection();
            var notifyProxy = connection.createHubProxy('notifyHub');
            notifyProxy.on('notify', function (msg) {
                var obj = JSON.parse(msg);
                if (obj.state == 1) {
                    clearInterval(interval);
                    location.href = "/Cashie/PayRedirectResult?tradeNo=" + obj.tradeNo;
                }                
            });
            connection.start().done(function () {
                notifyProxy.invoke('registerApply', '@Model.ApplyId');
            });
        });
    </script>
</body>
</html>
